<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>微信绑定 | 大象与猩猩</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="alternate icon" type="image/png" href="assets/i/favicon.png">
<link rel="stylesheet" href="assets/css/amazeui.min.css" />
<link rel="stylesheet" href="js/sweet-js/sweet-alert.css">
<style>
.header {
	text-align: center;
}

.header h1 {
	font-size: 200%;
	color: #333;
	margin-top: 30px;
}

.header p {
	font-size: 14px;
}
</style>
</head>
<body onload="start()">
	<div class="header">
		<div class="am-g">
			<h1>大象与猩猩众创平台</h1>
			<p>
				Fruit. Life<br />水果-生活
			</p>
		</div>
		<hr />
	</div>
	<div class="am-g">
		<div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
			<h3>店长微信绑定</h3>
			<hr>
			<div class="am-btn-group">
				<a href="#" class="am-btn am-btn-secondary am-btn-sm"><i
					class="am-icon-lemon-o am-icon-sm"></i> 水果</a> <a href="#"
					class="am-btn am-btn-success am-btn-sm"><i
					class="am-icon-user-plus am-icon-sm"></i> 生活+</a> <a href="#"
					class="am-btn am-btn-primary am-btn-sm"><i
					class="am-icon-angellist am-icon-sm"></i> 健康</a>
			</div>
			<br> <br>

			<form id="loginForm" class="am-form" name="">
				<label for="phone">手机号:</label> <input required placeholder="请输入手机号"
					maxlength="11" type="tel" name="phone" id="phone" value="">
				<br> <label for="password">验证码:</label> <input required
					type="password" placeholder="请输入验证码" name="code" id="code" value="">
				<br> <br />
				<div class="am-cf am-margin-top-xs">
					<input id="login" onclick="sendcode()"
						class="am-btn am-btn-default am-btn-sm am-fl" value="发送验证码">
					<input   id="sure" onclick="submit1()"
						class="am-btn am-btn-primary am-btn-xl am-fr" value="确定">   
				</div>
			</form>
			<hr>
			<p>© 2014-2016 dxyxx, Inc. 浙ICP备14017672号</p>
		</div>
	</div>

	<script type="text/javascript" src="../resources/js/zepto1.1.6.min.js"></script>
	<script type="text/javascript" src="js/sweet-js/sweet-alert.js"></script>
	<script type="text/javascript">
		function sendcode() {

			var phone = $('#phone').val();

			if (phone) {
				// 调用网络 接口
				$.ajax({
					type : "get",
					url : "../sendBindCode?phone=" + phone,

					dataType : "json",
					success : function(data) {
						if (data.code == 1) {
							sweetAlert('验证码发送成功，请注意查收');
						} else {
							sweetAlert(data.info);
						}
					},
					error : function(data) {
					}
				});
			} else {
				sweetAlert('请输入手机号');
			}

		};
		function enjoy() {
			return false;
		}
		function submit1() {// 名字不能是submit
			// 向 微信 发起请求 
			var phone = $('#phone').val();
			var code = $('#code').val();
			if (phone && code) {
				backUri = encodeURIComponent("https://rs88881234.com/chinesejie/verifyBindCode?mcode="
						+ code + "&phone=" + phone);
				// 

				url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx1d8e9a967a8c62bd&redirect_uri="
						+ backUri
						+ "&response_type=code&scope=snsapi_base&state=123#wechat_redirect";

				//window.location.replace(url);//微信上使用 好像有问题
				window.location.href = url;

			}
		};
	</script>
</body>
</html>